# 安装requests
# pip install requests
import requests

# 获取网页内容
url = requests.get('https://www.w3school.com.cn/')

# print(url)
# print(url.status_code)  # 获取响应状态码
# print(url.headers)  # 获取响应头
# print(url.content)  # 获取响应内容
# print(url.reason)  # 响应状态描述
# print(url.apparent_encoding)  # 返回编码

x = requests.get('https://www.runoob.com/try/ajax/json_demo.json')
print(x.json())  # 返回json数据